summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflodavid <fl.david.53@gmail.com>2023-10-12 00:17:06 +0200
committerflodavid <fl.david.53@gmail.com>2023-10-12 01:53:54 +0200
commit48b67fc4a01e5add97f28e317a8af2e7d3e429b6 (patch)
tree99578c9bf4ccf38b62485d27ea88b128e3da3c2c
parentyuzu: Use new setting method for stop emulation (diff)
downloadyuzu-48b67fc4a01e5add97f28e317a8af2e7d3e429b6.tar
yuzu-48b67fc4a01e5add97f28e317a8af2e7d3e429b6.tar.gz
yuzu-48b67fc4a01e5add97f28e317a8af2e7d3e429b6.tar.bz2
yuzu-48b67fc4a01e5add97f28e317a8af2e7d3e429b6.tar.lz
yuzu-48b67fc4a01e5add97f28e317a8af2e7d3e429b6.tar.xz
yuzu-48b67fc4a01e5add97f28e317a8af2e7d3e429b6.tar.zst
yuzu-48b67fc4a01e5add97f28e317a8af2e7d3e429b6.zip
-rw-r--r--src/yuzu/configuration/config.cpp2
-rw-r--r--src/yuzu/main.cpp41
-rw-r--r--src/yuzu/main.h4
3 files changed, 29 insertions, 18 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index bc47d1688..d5157c502 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -128,7 +128,7 @@ const std::array<UISettings::Shortcut, 22> Config::default_hotkeys{{
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Fullscreen")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F11"), QStringLiteral("Home+B"), Qt::WindowShortcut, false}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load File")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+O"), QStringLiteral(""), Qt::WidgetWithChildrenShortcut, false}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load/Remove Amiibo")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F2"), QStringLiteral("Home+A"), Qt::WidgetWithChildrenShortcut, false}},
- {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Restart Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F6"), QStringLiteral(""), Qt::WindowShortcut, false}},
+ {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Restart Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F6"), QStringLiteral("R+Plus+Minus"), Qt::WindowShortcut, false}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Stop Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F5"), QStringLiteral("L+Plus+Minus"), Qt::WindowShortcut, false}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Record")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F7"), QStringLiteral(""), Qt::ApplicationShortcut, false}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Reset")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F6"), QStringLiteral(""), Qt::ApplicationShortcut, false}},
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 2727f9d06..425f546f7 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -3400,10 +3400,13 @@ void GMainWindow::OnRestartGame() {
if (!system->IsPoweredOn()) {
return;
}
- // Make a copy since ShutdownGame edits game_path
- const auto current_game = QString(current_game_path);
- ShutdownGame();
- BootGame(current_game);
+
+ if (ConfirmShutdownGame()) {
+ // Make a copy since ShutdownGame edits game_path
+ const auto current_game = QString(current_game_path);
+ ShutdownGame();
+ BootGame(current_game);
+ }
}
void GMainWindow::OnPauseGame() {
@@ -3425,15 +3428,27 @@ void GMainWindow::OnPauseContinueGame() {
}
void GMainWindow::OnStopGame() {
- // Open (or not) the right confirm dialog based on current setting and game exit lock
+ if (ConfirmShutdownGame()) {
+ play_time_manager->Stop();
+ // Update game list to show new play time
+ game_list->PopulateAsync(UISettings::values.game_dirs);
+ if (OnShutdownBegin()) {
+ OnShutdownBeginDialog();
+ } else {
+ OnEmulationStopped();
+ }
+ }
+}
+
+bool GMainWindow::ConfirmShutdownGame() {
if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) {
if (system->GetExitLocked()) {
if (!ConfirmForceLockedExit()) {
- return;
+ return false;
}
} else {
if (!ConfirmChangeGame()) {
- return;
+ return false;
}
}
} else {
@@ -3441,19 +3456,11 @@ void GMainWindow::OnStopGame() {
ConfirmStop::Ask_Based_On_Game &&
system->GetExitLocked()) {
if (!ConfirmForceLockedExit()) {
- return;
+ return false;
}
}
}
-
- play_time_manager->Stop();
- // Update game list to show new play time
- game_list->PopulateAsync(UISettings::values.game_dirs);
- if (OnShutdownBegin()) {
- OnShutdownBeginDialog();
- } else {
- OnEmulationStopped();
- }
+ return true;
}
void GMainWindow::OnLoadComplete() {
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 711c53a32..178eef294 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -426,6 +426,10 @@ private:
bool CheckSystemArchiveDecryption();
bool CheckFirmwarePresence();
void ConfigureFilesystemProvider(const std::string& filepath);
+ /**
+ * Open (or not) the right confirm dialog based on current setting and game exit lock
+ */
+ bool ConfirmShutdownGame();
QString GetTasStateDescription() const;
bool CreateShortcut(const std::string& shortcut_path, const std::string& title,